package com.jwdf.uda.http.action;

import android.content.Context;
import android.text.TextUtils;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import retrofit2.Call;

/**
 * 类说明：获取搭配列表请求
 * 作者：huangqiuxin on 2016/5/13 16:24
 * 邮箱：648859026@qq.com
 */
public class CollocationListAction extends AHttpService<PbBean.PbResGuideGetGuideList> {

    private int offset;
    private PbBean.PbSignPageFilterType type;
    private String userId;

    private CollocationListAction(Context context, String userId, int offset, PbBean.PbSignPageFilterType type) {
        super(context);
        this.offset = offset;
        this.type = type;
        this.userId = userId;
    }
    private CollocationListAction(Context context, int offset, PbBean.PbSignPageFilterType type) {
        super(context);
        this.offset = offset;
        this.type = type;
    }
    private CollocationListAction(Context context, int offset) {
        super(context);
        this.offset = offset;
        this.type = PbBean.PbSignPageFilterType.PAGE_FILTER_TYPE_NONE;
    }
    public static CollocationListAction newInstance(Context context, String userId, int offset, PbBean.PbSignPageFilterType type) {
        return new CollocationListAction(context, userId, offset, type);
    }
    public static CollocationListAction newInstance(Context context, int offset, PbBean.PbSignPageFilterType type) {
        return new CollocationListAction(context, offset, type);
    }
    public static CollocationListAction newInstance(Context context, int offset) {
        return new CollocationListAction(context, offset);
    }
    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqGuideGetGuideList.Builder builder = PbBean.PbReqGuideGetGuideList.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setOffset(offset);
        builder.setFilterType(type);
        if (!TextUtils.isEmpty(userId)) {
            builder.setUserId(userId);
        }

        return apiService.getGuideList(builder.build());
    }
}
